package train48days;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Scanner;
import java.util.Stack;

public class 洗牌 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int c = sc.nextInt();
        for (int i = 0; i < c ; i++) {
            int n= sc.nextInt();
            int t= sc.nextInt();
            ArrayList<Integer>  arr = new ArrayList<>();
            for (int j = 0; j < 2*n; j++) {
                arr.add(sc.nextInt());
            }
            Stack<Integer> left = new Stack<>();
            Stack<Integer> right = new Stack<>();

            for (int x = 0; x < t; x++) {
                for (int j = 0; j <n ; j++) {
                    left.add(arr.get(j));
                }
                for (int j = n; j <2*n; j++) {
                    right.add(arr.get(j));
                }
                arr.clear();
                for (int j = 0; j < n; j++) {
                    arr.add(right.pop());
                    arr.add(left.pop());
                }
                Collections.reverse(arr);
            }
            System.out.println(arr.toString().replace("[", "")
                    .replace("]", "")
                    .replace(",", ""));
        }
    }
}
